Skip to content

fix: silent false-pass bugs (schema, deep equality, NaN)#21

Merged
tugkanboz merged 1 commit into
mainfrom
fix/assertion-correctness
Jun 3, 2026
Merged

fix: silent false-pass bugs (schema, deep equality, NaN)#21
tugkanboz merged 1 commit into
mainfrom
fix/assertion-correctness

Conversation

@tugkanboz

Copy link
Copy Markdown
Member

Tier 0 of the deep review: the three correctness bugs that made tests pass when they should fail.

  • expectJsonSchema called validate() with arguments swapped, so schema validation never ran (passed for most bodies). Fixed, and the two tests that codified the broken behavior are rewritten to assert real validation.
  • matches()/deepEqual compared only own-enumerable keys, so all Dates/RegExps/Maps/Sets were equal (Date has no keys). Now delegates to the correct isEqual.
  • Schema validator accepted NaN for type number and let it pass minimum/maximum. Now requires finite numbers.

New regression test file, 644 unit tests green, tsc clean. Version 1.1.1.

- expectJsonSchema validated with swapped args, so schema checks were a no-op;
  now validates body against schema (and the codifying tests are corrected).
- matches()/deepEqual treated all Date/RegExp/Map/Set as equal (silent false
  pass); now delegates to isEqual.
- JSON-schema validator now rejects NaN for type number and range checks.
@tugkanboz tugkanboz merged commit a6a821e into main Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant